//
// Created by 严敏 on 2020/9/2.
// Copyright (c) 2020 上海创米科技有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <CoreLocation/CoreLocation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 地理位置获取之后的回调block
 @param location 获取的CLLocation，失败时为nil
 @param error 定位失败时返回的信息，成功时为nil
 */
typedef void(^LocationUpdateCallBack)(CLLocation *_Nullable location, NSError *_Nullable error);

typedef void(^LocationAuthorizationStateCallBack)(BOOL isAuthorized);

@interface ILRNILocationUtil : NSObject <CLLocationManagerDelegate>

+ (instancetype)sharedInstance;

//设置获取地理位置回调
- (void)setLocationUpdateListener:(nullable LocationUpdateCallBack)locationUpdateCallBack;

//开启获取地址位置
- (void)startUpdateLocation;

//停止获取地址位置
- (void)stopUpdatingLocation;

//发起定位授权
- (void)requestLocationAuthorized:(LocationAuthorizationStateCallBack)locationAuthorizationStateCallBack;

//定位是否可用
- (BOOL)isLocationEnabled;

//定位可使用权限
- (BOOL)isLocationAuthorization;

//（定位可用+定位可使用权限）
- (BOOL)canUseLocation;

//获取最后一次定位位置数据
- (CLLocation *)getLastLocation;

//获取定位权限
- (CLAuthorizationStatus)getLocationAuthorizationStatue;


@end

NS_ASSUME_NONNULL_END
